<?php
require_once(OC::$SERVERROOT . "/apps/reports/lib/helper.php");
require_once(OC::$SERVERROOT . "/apps/reports/lib/reports.php");

if (!PFactory::isMasterUser()) {
   echo '您无权访问该资源';
   exit();
}

$start = JRequest::getString('start', '');
$end = JRequest::getString('end', '');
$datetype = JRequest::getString('datetype', '');
$xtypes = array('job', 'resume', 'processed', 'event', 'offer', 'entry');

$model = new PReportsModelReports();
$subList = $model->getSubaccountList();

if ($subList === false) {
   jexit('<div class="yahei large noreportsdata">' . ($model->getError() ? $model->getError() : '系统错误') . '</div>');
}
?>

<div class="rep_allpos">共<span><?=count($subList)?></span>个子账号</div>

<div class="rep_resumefrom" style="margin-top:20px;">
   <div class="rep_detailtable">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <th width="13%">子账号</th>
            <th width="11%">职位</th>
            <th width="13%">简历</th>
            <th width="13%">已处理简历</th>
            <th width="10%">面试</th>
            <th width="13%">发offer</th>
            <th width="10%">入职</th>
            <th width="17%">详细报表</th>
         </tr>
         <? if (!empty($subList)): ?>
            <? foreach ($subList as $l): ?>
               <tr>
                  <td class="tleft"><?=$l['displayname']?></td>
                  <? foreach ($xtypes as $x): ?>
                     <td><?=(!empty($l['total'][$x]) ? $l['total'][$x] : 0)?></td>
                  <? endforeach; ?>
                  <td class="rep_tdaction medium"><a href="<?php echo OC_Helper::linkToRoute("reports_subaccountdetail", array('uid' => $l['uid'], 'start' => $start, 'end' => $end, 'datetype' => $datetype)); ?>">查看</a> <a href="#" class="hide">导出</a> <a href="#" class="hide">打印</a></td>
               </tr>
            <? endforeach; ?>
         <? else: ?>
            <tr><td colspan="8"><div class="nodatacolor">暂无子账号信息</div></td></tr>
         <? endif;?>
      </table>
   </div>
</div>

<script type="text/javascript">
$(document).ready(function(){
});
</script>